package com.longrise.android.byjk.plugins.vip.integralexchange;

import com.longrise.LEAP.Base.Objects.EntityBean;
import com.longrise.common.base.BaseActivity;
import com.longrise.android.byjk.common.UrlConstants;
import com.longrise.android.byjk.model.UserInfor;
import com.longrise.common.datasource.remote.LoadDataManager;

/**
 * Created by callxkj on 2017/8/9.
 * 保宝app通过分享获取积分的帮助类
 */

public class ShareGetIntegralHelper {

    public static void toShowIntegral(final BaseActivity activity, String dailytaskname) {
        EntityBean bean = new EntityBean();
        bean.set("userid", UserInfor.getInstance().getUserid());
        bean.set("cardno", UserInfor.getInstance().getUsersfzh());
        bean.set("dailytaskname",dailytaskname);
        EntityBean reqBean = new EntityBean();
        reqBean.set("bean", bean);
        LoadDataManager.getInstance().callService(null, UrlConstants.BaseUrl,
                "bbt_vip_iVipUserScoresbyDailyTask", reqBean, new LoadDataManager.OnRequestCallListener() {

            @Override
            public void onSuccess(String key, String service, Object result) {
                EntityBean resultBean = (EntityBean) result;
                if (resultBean != null && resultBean.getInt("resultstate") == 1) {
                    EntityBean bean1 = resultBean.getBean("result");
                    String acquiredscore = bean1.getString("acquiredscore");
                    String infostate = bean1.getString("infostate"); //状态
                    String remindwords = bean1.getString("remindwords");
                    if("1".equals(infostate)){  //1.表示成功 2.已经完成过 0.任务完成失败
//                        MyIntegralDialogUtil.showIntegralDailog(activity,acquiredscore,remindwords);
                    }
                }
            }

            @Override
            public void onError(String key, String service, Throwable ex, boolean isOnCallback) {
                //不写提示信息
            }

            @Override
            public void onFinished(String key, String service) {
            }
        });
    }
}
